import { NgModule, ContentChild } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ModuleWithProviders } from '@angular/core';

import { LayoutContentComponent } from './shared/layout/content/layout.content.component';

import { HomeComponent } from './home/home.component';
import { ExaminationComponent } from './examination/examination.component';
import { CanDeactivateGuardService } from '../can-deactivate-guard.service';
import { QuestionComponent } from './question/question.component';
import { QuestionDetailComponent } from './question-detail/question-detail.component';
import { QuestionCreateComponent } from './question-create/question-create.component';
import { FileuploadComponent } from './fileupload/fileupload.component';
import { FileuploadListComponent } from './fileupload-list/fileupload-list.component';
import { TaotiComponent } from './taoti/taoti.component';
import { AlterTaotiComponent } from './alter-taoti/alter-taoti.component';
import { AlterTaotiDetailComponent } from './alter-taoti-detail/alter-taoti-detail.component';
import { TaotiDetailComponent } from './taoti-detail/taoti-detail.component';

const pagesRoutes: Routes = [
    {
        path: 'content',
        component: LayoutContentComponent,
        canActivate: [CanDeactivateGuardService],
        children: [
            { path: '', redirectTo: 'home', pathMatch: 'full' },
            {
                path: 'home',
                component: HomeComponent
            },
            {
                path: 'examination/:id',
                component: ExaminationComponent
            },
            {
                path: 'question',
                component: QuestionComponent
            },
            {
                path: 'questiondetail/:id',
                component: QuestionDetailComponent
            },
            {
                path: 'createquestion',
                component: QuestionCreateComponent
            },
            {
                path: 'fileUpload',
                component: FileuploadComponent
            },
            {
                path: 'fileUploadList',
                component: FileuploadListComponent
            },
            {
                path: 'taoti',
                component: TaotiComponent
            },
            {
                path: 'taotiDetail/:id',
                component: TaotiDetailComponent
            },
            {
                path: 'alterTaoti/:id',
                component: AlterTaotiComponent
            },
            {
                path: 'alterTaotiDetail/:taoti/:type/:id',
                component: AlterTaotiDetailComponent
            }
        ]
    }
];

@NgModule({
    imports: [RouterModule.forChild(pagesRoutes)],
    exports: [RouterModule]
})
export class PagesRoutingModule {}
